package cn.funeralobjects.ams.converter;

import com.aliyuncs.http.MethodType;

import javax.persistence.AttributeConverter;

/**
 * Converter of MethodType
 *
 * @author FuneralObjects
 * Create date: 2020/5/28 3:49 PM
 */
public class MethodTypeConverter implements AttributeConverter<MethodType, String> {
    @Override
    public String convertToDatabaseColumn(MethodType attribute) {
        return attribute == null ? null : attribute.name();
    }

    @Override
    public MethodType convertToEntityAttribute(String dbData) {
        return dbData == null ? null : MethodType.valueOf(dbData);
    }
}
